#include<iostream>//B
#include<cstdio>
#include<algorithm>
using namespace std;
int n,q,a[8001];
struct node{
	int id,x;
}b[8001];
bool cmp(node x,node y)
{
	if(x.x==y.x)return x.id<y.id;
	return x.x<y.x;
}
int f(int x)
{
	for(int i=1;i<=n;i++)b[i]=((node){i,a[i]});
	sort(b+1,b+1+n,cmp);
	for(int i=1;i<=n;i++)if(b[i].id==x)return i;
}
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	while(q--)
	{
		int x;
		scanf("%d",&x);
		if(x==1)
		{
			int y,z;
			scanf("%d%d",&y,&z);
			a[y]=z;
		}
		else
		{
			int y;
			scanf("%d",&y);
			printf("%d\n",f(y));
		}
	}
	return 0;
}

